﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using BLL;
using Util;
public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string username = tbAccount.Text.Trim();
        string password = tbPassword.Text.Trim();
        if (username == "" && password == "")
        {
            UtilWeb.Message(this, KoInfo.LoginEmpty, null);
            return;
        }
        if (new BllAdmin(this).Login(username, password))
        {
            HttpCookie cookie = new HttpCookie(KoInfo.CookieAdmin);
            cookie.Value = username;
            cookie.Expires = DateTime.Now.AddDays(KoInfo.CookieExpireShort);
            Response.Cookies.Add(cookie);
            Response.Redirect("index.html");
        }

    }

}